﻿import cms = som.CustomerModels;
import cvs = sov.CustomerViews;
import som = require("SalesOrderModels");
import sov = require("SalesOrderViews");
import bb = Backbone;

export module CustomerRouters {
    export class CustomerSalesOrderRouter extends bb.Router {
        constructor() {
            this.routes = <any>{
                "startState": "initializeList",
                "customer/cid:cust": "getCustomer"
            }
            super();
        }

        initializeList() {
            var cv = new cvs.CustomersSelectView();
            cv.collection = new cms.CustomerShortList();
            cv.$el = $("#Customers");
            cv.collection.fetch({ success: () => cv.render() });
        }

        getCustomer(cust: string) {
            alert(cust);
        }
    }
}